/*
 *
关羽	15000
张飞	14000
诸葛亮	20000
赵云	13000
黄忠	12000
请输入查找人员姓名: 张飞 
14000

 */
#include <iostream>
#include <map>
using namespace std;
int main(void){

	string name[]={"关羽","张飞", "赵云"};
	double salary[]={15000,14000,13000};
	map<string, double> sa1;
	map<string, double>::iterator p; // 迭代器
	for(int i=0; i<3; i++){
		sa1.insert(make_pair(name[i], salary[i]));
	}
	/*通过下标运算加入新元素*/
	sa1["诸葛亮"] = 20000;
	sa1["黄忠"] = 12000;
	for(p=sa1.begin(); p!=sa1.end(); p++){
		cout << p->first <<"\t" << p->second << endl;
	}

	string person;
	cout << "请输入查找人员姓名: ";
	cin >> person;
	for(p=sa1.begin(); p!=sa1.end(); p++){
		if(p->first == person)
			cout << p->second << endl;
	}
	return 0;
}
